package jp.co.cos.ittrick.channel.controller.admin;

import jp.co.cos.ittrick.channel.model.PreModel;
import jp.co.cos.ittrick.channel.service.PreService;

import org.slim3.controller.Controller;
import org.slim3.controller.Navigation;

public class PreEditController extends Controller {

    private PreService preService;

    public PreEditController() {
        preService = new PreService();
    }

    @Override
    public Navigation run() throws Exception {

        String channel = asString("channel");
        String chapter = asString("chapter");
        String page = asString("page");
        String pre = asString("pre");

        PreModel preModel = preService.getPreByKey(Integer.valueOf(pre));

        requestScope("preModel", preModel);
        requestScope("channel", channel);
        requestScope("chapter", chapter);
        requestScope("page", page);
        requestScope("pre", pre);

        return forward("preEdit.jsp");
    }
}
